<template>
	<view class="bgf">
		<card>
			<view class="df fdc ac w25 mb25" @click="goAddMeeting">
				<view class="background-icon">
					<image
						class="icon-cont"
						src="https://fe-static.yilife.cn/svg/office-software/82628c62196a5b8018f579007064f55b.svg"
					></image>
				</view>

				<view class="item-name">预定会议</view>
			</view>
		</card>
		<view class="p20"><text>待参加会议</text></view>
		<card v-for="meeting in meetingList" v-bind:key="meeting.scheduleId">
			<meeting-detail
				:scheduleId="meeting.scheduleId"
				:meetingId="meeting.meetingId"
				:meetingCode="meeting.meetingCode"
				:meetingUrl="meeting.meetingUrl"
				:name="meeting.name"
				:weekStr="meeting.weekStr"
				:dateStr="meeting.dateStr"
				:startTime="meeting.startTime"
				:endTime="meeting.endTime"
				:createName="meeting.createName"
				:createIsSelf="meeting.createIsSelf"
				:totalNum="meeting.totalNum"
				:agreeNum="meeting.agreeNum"
				:refuseNum="meeting.refuseNum"
				:statu="meeting.statu"
				@reloadList="getMeetingList"
			></meeting-detail>
		</card>

		<view>
			<diy-empty v-show="isShowEmpty"></diy-empty>
		</view>
	</view>
</template>
<script>
import Card from '../components/card.vue'
import MeetingDetail from '../components/meeting/detail.vue'
import diyEmpty from '@/components/diy-empty/diy-empty.vue'

export default {
	components: {
		card: Card,
		diyEmpty,
		'meeting-detail': MeetingDetail,
	},
	data() {
		return {
			meetingList: [],
			seen: false,
		}
	},
	computed: {
		isShowEmpty() {
			return this.meetingList.length > 0 ? false : true
		},
	},
	onShow() {
		this.getMeetingList()
	},
	methods: {
		// otherFun(isGetList) {
		//     if(isGetList) {
		//         this.getMeetingList()
		//     }
		// },
		getMeetingList() {
			uni.showLoading({
				title: '加载中...',
			})
			this.$request
				.request('carer-platform/work/log/schedule/getMeetingList', {
					method: 'get',
					data: {
						orgId: uni.getStorageSync('orgId'),
						pageIndex: 1,
						pageSize: 5000,
					},
				})
				.then((res) => {
					this.meetingList = res.data || []
				})
				.finally(() => {
					uni.hideLoading()
				})
		},
		goAddMeeting() {
			uni.navigateTo({
				url: `/subPackagesLog/pages/workLog/schedule/create`,
			})
		},
	},
}
</script>

<style lang="scss" scoped>
.background-icon {
	width: 100rpx;
	height: 100rpx;
	border-radius: 25rpx;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	background-color: #1e90ff;

	.icon-cont {
		height: 60rpx;
		line-height: 60rpx;
	}
}

.item-name {
	margin-top: 15rpx;
	font-size: 26rpx;
	color: #666;
	max-width: 80px;
	text-align: center;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
</style>
